import { EEventUI } from "../../script/enum/EEventUI";
import { EEventScene } from "../../script/enum/EEventScene";

// 简易信息类
export default class MesManager extends Laya.EventDispatcher {
    public static get instance(): MesManager {
        if (this._instance == null) {
            this._instance = new MesManager();
        }
        return this._instance;
    }

    private static _instance: MesManager;

    eventUI(event: EEventUI, data?: any) {
        console.log("UI " + event)
        MesManager.instance.event(event, data);
    }

    event3d(event: EEventScene, data?: any) {
        console.log("Scene " + event)
        MesManager.instance.event(event, data);
    }

    onUI(type: EEventUI, caller: any, listener: Function, args?: any[]) {
        MesManager.instance.on(type, caller, listener, args);
    }

    offUI(type: EEventUI, caller: any, listener: Function) {
        MesManager.instance.off(type, caller, listener);
    }

    off3d(type: EEventScene, caller: any, listener: Function, args?: any[]) {
        MesManager.instance.off(type, caller, listener);
    }

    on3d(type: EEventScene, caller: any, listener: Function, args?: any[]) {
        MesManager.instance.on(type, caller, listener, args);
    }
}